home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2001 December / pcwk12201b.iso / Wersje pelne i specjalne / Winamp 2.77 i 3.0beta / wasabi-sdk_beta1.exe / studio / attribs / cfgitemi.h < prev    next >
C/C++ Source or Header  |  2001-10-08  |  3KB  |  92 lines

  1. /*
  2.  
  3.   Nullsoft WASABI Source File License
  4.  
  5.   Copyright 1999-2001 Nullsoft, Inc.
  6.  
  7.     This software is provided 'as-is', without any express or implied
  8.     warranty.  In no event will the authors be held liable for any damages
  9.     arising from the use of this software.
  10.  
  11.     Permission is granted to anyone to use this software for any purpose,
  12.     including commercial applications, and to alter it and redistribute it
  13.     freely, subject to the following restrictions:
  14.  
  15.     1. The origin of this software must not be misrepresented; you must not
  16.        claim that you wrote the original software. If you use this software
  17.        in a product, an acknowledgment in the product documentation would be
  18.        appreciated but is not required.
  19.     2. Altered source versions must be plainly marked as such, and must not be
  20.        misrepresented as being the original software.
  21.     3. This notice may not be removed or altered from any source distribution.
  22.  
  23.  
  24.   Brennan Underwood
  25.   brennan@nullsoft.com
  26.  
  27. */
  28.  
  29. #ifndef _CFGITEMI_H
  30. #define _CFGITEMI_H
  31.  
  32. #include "cfgitem.h"
  33.  
  34. #include "../common/named.h"
  35. #include "../common/ptrlist.h"
  36. #include "../common/multimap.h"
  37. #include "../common/depend.h"
  38.  
  39. class AttrCallback;
  40. class Attribute;
  41.  
  42. // this is the one you inherit from/use
  43. class CfgItemI : public CfgItem, public DependentI, private Named {
  44. public:
  45.   CfgItemI(const char *name=NULL);
  46.   virtual ~CfgItemI();
  47.  
  48.   const char *cfgitem_getName();
  49.   int cfgitem_getNumAttributes();
  50.   const char *cfgitem_enumAttribute(int n);
  51.   Dependent *cfgitem_getDependencyPtr() { return this; };
  52.  
  53.   virtual int cfgitem_getNumChildren();
  54.   virtual CfgItem *cfgitem_enumChild(int n);
  55.   virtual void cfgitem_shutdown();
  56.  
  57.   virtual int getAttributeType(const char *name);
  58.   virtual int getDataLen(const char *name);
  59.   virtual int getData(const char *name, void *data, int data_len);
  60.   virtual int setData(const char *name, void *data, int data_len);
  61.  
  62.   // override these to catch notifications from attribs, call down
  63.   virtual int cfgitem_onAttribSetValue(Attribute *attr);
  64.  
  65.   int setName(const char *name);
  66.   int registerAttribute(Attribute *attr, AttrCallback *acb=NULL);
  67.   // does not call delete on the attribute
  68.   int deregisterAttribute(Attribute *attr);
  69.   void deregisterAll();
  70.  
  71.   void addCallback(Attribute *attr, AttrCallback *acb);
  72.  
  73.   virtual void cfgitem_onRegisterAttribute(Attribute *attr);
  74.   virtual void cfgitem_onDeregisterAttribute(Attribute *attr);
  75.  
  76.   
  77.  
  78. protected:
  79.   RECVS_DISPATCH;
  80.  
  81.   Attribute *getAttributeByName(const char *name);
  82.  
  83.   void addChildItem(CfgItemI *child);
  84.  
  85. private:
  86.   PtrList<Attribute> attributes;
  87.   MultiMap<Attribute*, AttrCallback> callbacks;
  88.   PtrList<CfgItemI> children;
  89. };
  90.  
  91. #endif
  92.